## Check if everything installed
required_packages <- c("knitr", "arm", "lubridate", "stargazer", "lme4",
                       "reshape2", "estimatr", "tidyverse", "doMC", "texreg",
                       "PanelMatch", "RColorBrewer", "gridExtra", "stargazer",
                       "xtable", "lattice", "grid", "patchwork", "ggcorrplot",
                       "sp", "rgdal", "maps", "mapdata", "maptools", "ggmap")

allpkgs <- installed.packages()
if(!all(required_packages %in% rownames(allpkgs))){
  not_installed <- required_packages[!(required_packages %in% rownames(allpkgs))]
  install.packages(not_installed)
}
